from django.urls import path
from apps.users.views import UsernameCountView, PhoneCountView, RegisterView, LoginView, LogoutView, \
    UserInfoView, ChangeUseInfoView, ChangePwdView, AddressCreateView, AddressView, UpdateDestroyAddressView, \
    SetDefaultView, UpdateTitleView, HistoryView, ShowLikesView, CheckImageCodeView

urlpatterns = [
    # 判断手机号是否重复
    # 使用转换器接收路由中的参数
    path('usernames/<username:username>/count/', UsernameCountView.as_view()),
    path('phone/<phone:phone>/count/', PhoneCountView.as_view()),
    path('register/', RegisterView.as_view()),
    path('check/image_code/', CheckImageCodeView.as_view()),
    path('login/', LoginView.as_view()),
    path('logout/', LogoutView.as_view()),
    path('user_info/', UserInfoView.as_view()),
    path('change_info/', ChangeUseInfoView.as_view()),
    path('change_password/', ChangePwdView.as_view()),
    path('addresses/create/', AddressCreateView.as_view()),
    path('addresses/', AddressView.as_view()),
    path('addresses/<id>/', UpdateDestroyAddressView.as_view()),
    path('addresses/<id>/default/', SetDefaultView.as_view()),
    path('addresses/<id>/title/', UpdateTitleView.as_view()),
    path('history/', HistoryView.as_view()),
    path('likes/', ShowLikesView.as_view()),
]
